from colorama import Fore, Style

import pinia
from data.config.DefaultConfig import player_data
from entiys.map.MapSaveManager import MapSaveManager


def pprint(_dict: dict):
    playerdata = player_data(**_dict)
    where = playerdata.Where if playerdata.Where != "home" else playerdata.Home[0].get('name') + "(家里)"
    if playerdata.Where == "home":
        descript = playerdata.Home[0].get('descript')
        where = playerdata.Home[0].get('name') + "(家里)"
    else:
        descript = MapSaveManager(saveName=pinia.store.get("savename")).getPointDetail(playerdata.Where)
        if descript is None:
            descript = "这里暂时还是个神秘的地方呢!"
        else:
            descript = descript.get("描述")
        where = playerdata.Where

    print(f"当前所在位置: {Fore.GREEN} {where} {Fore.WHITE} | 所剩金额: {Fore.LIGHTMAGENTA_EX} {playerdata.Money} {Fore.WHITE}\n" +
          f"{Fore.CYAN} {descript}{Fore.WHITE}" )


